package com.shangxian.giveithome.mapper;


import com.shangxian.giveithome.entity.*;
import com.shangxian.giveithome.entity.community.PetSimpleInformation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.web.PageableDefault;

import java.util.List;

@Mapper
public interface PetMapper {

    /**
     * 根据宠物id集合查询宠物集合
     *
     * @param pets
     * @return
     */
    List<Pet> queryByUsPet(@Param("pets") List<Long> pets);

    /**
     * 查询品种名称
     *
     * @return
     */
    String queryPetVarieties(Long id);


    /**
     * 查询品种集合
     *
     * @return
     */
    List<Varieties> queryPetVarietiesS();

    /**
     * 查询寻宠指定条件总数
     *
     * @param searchScreen
     * @return
     */
    Integer queryCountSearchPet(SearchScreen searchScreen);

    /**
     * 根据条件查看寻宠列表
     *
     * @param searchScreen
     * @param pageNum
     * @param pageSize
     * @return
     */
    List<SearchPetList> querySearchPet(@Param("search") SearchScreen searchScreen, @Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    /**
     * 根据id查询寻宠详情相关信息
     *
     * @param id
     * @return
     */
    Pet querySearchPetDetails(Long id);

    /**
     * 查寻寻主列表总条数
     *
     * @param searchScreen
     * @return
     */
    Integer queryCountSearchPeople(SearchScreen searchScreen);

    /**
     * 查询寻主列表
     *
     * @param searchScreen
     * @param pageNum
     * @param pageSize
     * @return
     */
    List<SearchPeopleList> querySearchPeople(@Param("search") SearchScreen searchScreen, @Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    Pet querySearchPeopleDetails(Long id);

    Integer queryCountSearchAll(SearchScreen searchScreen);

    List<SearchAllList> querySearchAll(@Param("search") SearchScreen searchScreen, @Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    List<Pet> queryByAsylum(@Param("petIdS") List<Long> petIdS, @Param("asylumScreen") AsylumScreen asylumScreen,
                            @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);


    Integer queryCountAsylum(@Param("petIdS") List<Long> petIdS, @Param("asylumScreen") AsylumScreen asylumScreen);

    Pet queryByAsylumDetails(Long id);

    void save(PetCreate petCreate);

    void update(PetCreate petCreate);

    void delete(Long id);

    List<Pet> queryPlace(@Param("collect") List<Long> collect);

    Integer queryByPlaceSu(Long id);

    Integer queryCountPlace(PlaceScreen placeScreen);

    List<Pet> queryPlaces(@Param("placeScreen") PlaceScreen placeScreen,
                          @Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    List<PlaceLists> queryPlacesList(@Param("placeScreen") PlaceScreen placeScreen,
                          @Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    void updateSubordinate(@Param("petId") Long petId, @Param("status") int status);

    Pet queryPlaceDetails(Long id);

    void saveSearchPet(SearchPetCreate searchPetCreate);

    void updateSearchPet(SearchPetUpdate searchPetUpdate);

    void saveSearchPeoplet(SearchPeopleCreate searchPeopleCreate);

    void updateSearchPeople(SearchPeopleUpdate searchPeopleUpdate);

    void savePlaceOutAdopt(PlaceCreate petCreate);

    void updatePlace(PlaceUpdate placeUpdate);

    // 根据id查询寻宠部分相关信息
    Pet querySimpleSearchPet(Long petId);

    // 根据id查询寻主部分相关信息
    Pet querySimpleSearchPeople(Long petId);

    Pet querySimplePlace(Long petId);

    void updateAllDataMeId(@Param("userId")Long userId, @Param("meId") Long meId);

    List<Varieties> selectCatVarieties();

    List<Varieties> selectDogVarieties();

    List<PlaceDetails> queryByUsPlaceDetails(@Param("pets") List<Long> petIds);

    void deleteUsPet(@Param("id") Long id, @Param("usId") Long usId);

    /**
     * 根据宠物id查询宠物id 性别 名称
     */
     PetSimpleInformation findPetInformation(Long id);

    /**
     * 根据宠物id查询领养人id
     */

    Long findAdCollectionId(Long id);

    /**
     * 根据领养人id查询用户领养合集列表
     */
    PageableDefault getPetDynamic(Long id, int pageNumber, int pageSize);

    /**
     * 根据宠物id 和宠物状态查询是否有当前类别的宠物
     */
    int findPetByIdAndSub(Long id, int sid);
}
